using System;
using System.Collections.Generic;
using System.Text;

namespace PokerLearner.Poker
{
	public enum PacketType : byte
	{
		Kick, 
		Connect,
		ConnectResponse,
		Disconnect,
		NewRound,
		Pocket,
		Flop,
		Turn,
		River,
		EndRound,

		/// <summary>
		/// Play request with empty payload 
		/// </summary>
		PlayRequest,

		/// <summary>
		/// Play packet with the Play instance in the payload
		/// </summary>
		Play,
	}

	[Serializable]
	public class Packet
	{
		private PacketType type;
		public PacketType Type
		{
			get { return type; }
			set { type = value; }
		}

		private object payload;
		public object Payload
		{
			get { return payload; }
			set { payload = value; }
		}

		public Packet()
		{
		}

		public Packet(PacketType type, object payload)
		{
			this.type = type;
			this.payload = payload;
		}

		public override string ToString()
		{
			if (type == PacketType.Connect)
				return "Connect " + payload;
			else if (type == PacketType.ConnectResponse)
				return "Connect Response ";
			else if (type == PacketType.Disconnect)
				return "Disconnect " + payload;
			else if (type == PacketType.Flop)
				return "Flop ";
			else if (type == PacketType.NewRound)
				return "New Round " + payload;
			else if (type == PacketType.Play)
				return "Play " + payload;
			else if (type == PacketType.PlayRequest)
				return "Play Request " + payload;
			else if (type == PacketType.Pocket)
				return "Pocket " + payload;
			else if (type == PacketType.River)
				return "River " + payload;
			else if (type == PacketType.Turn)
				return "Turn " + payload;
			else if (type == PacketType.EndRound)
				return "End Round " + payload;

			return "Unknown";
		}
	}
}
